load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"

location_f="/Users/ivana/WORK_BSC/AS/files/"

fw    = addfile(location_f + "streamfunction_ano_250hPa_djf_ipsl.nc", "r")

print(fw)

;*******************************************;
;Read in variables
;*******************************************
lat=fw->LAT
lon=fw->LON

nlat  = dimsizes(lat)
nlon  = dimsizes(lon)

ano=fw->STREAMFC_ANO_DJF 

ano = ano/100000

;-------------------------
; making the plots
;-------------------------
wks = gsn_open_wks("pdf","streamfunction_ano_djf_ipsl")
gsn_define_colormap(wks,"BlueDarkOrange18")

plot = new(1,graphic)                          ; create a plot array

  res          = True
  res@gsnDraw  = False                          ; don't draw
  res@gsnFrame = False                          ; don't advance frame, these 2
  res@cnInfoLabelOn = False                     ; turn off cn info label
  res@cnLinesOn           = True
  res@cnFillOn            = True            ; turn on color

  res@lbLabelBarOn        = True;False
  res@cnMonoLineColor = False
  res@gsnPolar = "NH"
  res@mpMinLatF = 0

  res@mpCenterLonF     = 290.     
  res@mpGeophysicalLineThicknessF = 2.

  res@cnMonoLineThickness=True
  res@cnLineThicknessF = 2.

  res@cnMonoLineColor=True
  res@cnLineColorF= "black"
  res@gsnContourNegLineDashPattern=1
  res@gsnContourZeroLineThicknessF=3

res@cnMissingValFillPattern = 0               ; choose fill pattern 0 (solid
res@cnMissingValFillColor   = "grey"  
res@lbAutoManage = False
res@lbLabelFontHeightF  = 0.017
res@pmLabelBarHeightF  = 0.08

res@cnLevelSelectionMode =  "ExplicitLevels"
res@cnLevels =(/-20,-15,-10,-7.5,-5,-2.5,0,  2.5, 5, 7.5,10., 15.,20./)
res@cnFillColors = (/2,3,4,5,8,10,0,0,13,14,15,16,17,18/)

res@gsnCenterString       = ""
res@gsnLeftString       = ""

plot(0)   = gsn_csm_contour_map(wks,ano,res)

;*************************
;
;________________________
 resP            = True

resP@gsnPanelLabelBar    = False;True                ; add common colorbar
;resP@lbLabelFontHeightF  = 0.007               ; make labels smaller

resP@gsnPanelBottom   = 0.05                   ; add space at bottom
;resP@gsnPanelFigureStrings= (/"a)","b)","c)"/) ; add strings to panel
res@txFontHeightF     = .24

resP@gsnMaximize    = True                ; maximize plot
gsn_panel(wks,plot,(/1,1/),resP)


